*****************************************************************
*****************************************************************
*****                                                       *****
*****       Mona Morgan-Collins (King's College London)     *****
*****        Contact: mona.morgan-collins@kcl.ac.uk         *****
*****                                                       *****
*****               Bringing in the New Votes:              *****
*****       Turnout of Women after Enfranchisement          *****
*****                                                       *****
*****        American Political Science Review              *****
*****                                                       *****
*****           Replicating Analyses in the Paper           *****
*****                                                       *****
*****************************************************************
*****************************************************************


*set seed  - setting the initial value of the random-number seed set as Stata's default when Stata is launched.
set seed 123456789
/* Because bootstrapping involves drawing pseudorandom numbers, the exact results of BOOTTEST command */
/* depend on the starting value of the random-number generator. */
/* This means that all  wild bootstrap results can be reproduced only on the first run of each do file */
/* after Stata is launched and when all BOOTTEST commands are run consecutively in each do file */ 
/* OR when seed is set as above before each do file is run and when all BOOTTEST commands are run consecutively in each do file */ 



*********************************
*Figure 1: When Do Newly Enfranchised Women Vote?
*********************************
*nothing to replicate

*********************************
*Figure 2: Gender Gap Plotted Against Men's Turnout 1909-1927 in Norway
*********************************
*Norway 1909-1918
use dta\nor0918, clear                              //using nor0918 data set
#delimit ;
 twoway (scatter turng turnm_pc    , mcolor(gs13) m(oh)) 
 (lowess turng turnm_pc  , lwidth(thick) lcolor(gray) )
 , ytitle(Gender Gap, size(huge)) ylabel(-60(20)20, labsize(huge)) 
 xtitle(Men's Turnout, size(huge)) xlabel(0(25)100, labsize(huge) ) 
 legend(off) scheme(s1mono) yline(0) ysize(6);
#delimit cr
*Norway 1921-1927
use dta\nor2127, clear                              //using nor2127 data set
#delimit ;
 twoway (scatter turng turnm_pc    , mcolor(gs13) m(oh)) 
 (lowess turng turnm_pc  , lwidth(thick) lcolor(gray) )
 , ytitle(Gender Gap, size(huge)) ylabel(-60(20)20, labsize(huge)) 
 xtitle(Men's Turnout, size(huge)) xlabel(0(25)100, labsize(huge) ) 
 legend(off) scheme(s1mono) yline(0) ysize(6);
#delimit cr

*********************************
*Figure 3: The Cross-Sectional Effect of District Margin on Turnout Measures in Norway 1909-1918
*********************************
use dta\nor0918, clear                        //using nor0918 data set
gen mar09 = margin
gen mar12 = margin
gen mar15 = margin
gen mar18 = margin
*sub-figure a
reg  turnf_pc mar09 if year==1909, robust
quietly estimates store y09
reg  turnm_pc mar09 if year==1909, robust
quietly estimates store y09m
reg  turnf_pc mar12 if year==1912, robust
quietly estimates store y12
reg  turnm_pc mar12 if year==1912, robust
quietly estimates store y12m
reg  turnf_pc mar15 if year==1915, robust
quietly estimates store y15
reg  turnm_pc mar15 if year==1915, robust
quietly estimates store y15m
reg  turnf_pc mar18 if year==1918, robust
quietly estimates store y18
reg  turnm_pc mar18 if year==1918, robust
quietly estimates store y18m
#delimit ;                                      
coefplot 
 (y09m,  msym(O) mcolor(black) mlabcolor(black) msize(large) ciopts(lcolor(black) lwidth(thick) recast(rcap)  )  ) 
 (y12m,  msym(O) mcolor(black) mlabcolor(black) msize(large) ciopts(lcolor(black) lwidth(thick) recast(rcap)  )  ) 
 (y15m,  msym(O) mcolor(black) mlabcolor(black) msize(large) ciopts(lcolor(black) lwidth(thick) recast(rcap)  )  ) 
 (y18m,  msym(O) mcolor(black) mlabcolor(black) msize(large) ciopts(lcolor(black) lwidth(thick) recast(rcap)  )  )   
 (y09,  msym(O) mcolor(gs7) mlabcolor(gs7) msize(large) ciopts(lcolor(gs7) lwidth(thick) recast(rcap)  )  ) 
 (y12,  msym(O) mcolor(gs7) mlabcolor(gs7) msize(large) ciopts(lcolor(gs7) lwidth(thick) recast(rcap)  )  ) 
 (y15,  msym(O) mcolor(gs7) mlabcolor(gs7) msize(large) ciopts(lcolor(gs7) lwidth(thick) recast(rcap)  )  ) 
 (y18,  msym(O) mcolor(gs7) mlabcolor(gs7) msize(large) ciopts(lcolor(gs7) lwidth(thick) recast(rcap)  )  ) 
 ,  yline(0, lcolor(black)) levels(95) scheme(s1mono) vertical  legend(off) grid (within) xtick(2.5, notick glstyle(refline))
 ylabel(-0.8(0.20)0.2, labsize(vlarge) ) 
 ytitle("The Effect of Margin", size(vlarge) ) 
 keep(mar09 mar12 mar15 mar18 ) coeflabels(mar15 = "1915" mar12 = "1912"  mar09 = "1909"  mar18 = "1918"    , labsize(vlarge) )
 text(0.17 1.5 "Tax-Paying Women", color(black) size(med)) text(0.17 3.5 "All Women", color(black) size(med)) ysize(6) ;
#delimit cr
*sub-figure b
reg  turng mar09 if year==1909, robust
quietly estimates store y09
reg  turng mar12 if year==1912, robust
quietly estimates store y12
reg  turng mar15 if year==1915, robust
quietly estimates store y15
reg  turng mar18 if year==1918, robust
quietly estimates store y18
#delimit ;                                      
coefplot 
 (y09,  msym(O) mcolor(gs10) mlabcolor(gs10) msize(large) ciopts(lcolor(gs10) lwidth(thick) recast(rcap)  )  ) 
 (y12,  msym(O) mcolor(gs10) mlabcolor(gs10) msize(large) ciopts(lcolor(gs10) lwidth(thick) recast(rcap)  )  ) 
 (y15,  msym(O) mcolor(gs10) mlabcolor(gs10) msize(large) ciopts(lcolor(gs10) lwidth(thick) recast(rcap)  )  ) 
 (y18,  msym(O) mcolor(gs10) mlabcolor(gs10) msize(large) ciopts(lcolor(gs10) lwidth(thick) recast(rcap)  )  ) 
 ,  yline(0, lcolor(black)) levels(95) scheme(s1mono) vertical nooffsets legend(off) grid (within) xtick(2.5, notick glstyle(refline))
 ylabel(-0.4(0.20)0.2, labsize(vlarge) ) 
 ytitle("The Effect of Margin", size(vlarge) ) 
 keep(mar09 mar12 mar15 mar18 ) coeflabels(mar15 = "1915" mar12 = "1912"  mar09 = "1909"  mar18 = "1918"    , labsize(vlarge) )
 text(0.17 1.5 "Tax-Paying Women", color(black) size(med)) text(0.17 3.5 "All Women", color(black) size(med))  ysize(6) ;
#delimit cr

*********************************
*Figure 4: The Cross-Sectional Effect of Within-District Concentration on Turnout Measures in Norway 1921-1927
*********************************
use dta\nor2127, clear                        //using nor2127 data set
gen hhi21 = hhi
gen hhi24 = hhi
gen hhi27 = hhi
*sub-figure a
reg  turnf_pc hhi21 i.districtPR if year==1921, cluster(districtPR)
quietly estimates store y21
reg  turnf_pc hhi24 i.districtPR if year==1924, cluster(districtPR)
quietly estimates store y24
reg  turnf_pc hhi27 i.districtPR if year==1927, cluster(districtPR)
quietly estimates store y27
reg  turnm_pc hhi21 i.districtPR if year==1921, cluster(districtPR)
quietly estimates store y21m
reg  turnm_pc hhi24 i.districtPR if year==1924, cluster(districtPR)
quietly estimates store y24m
reg  turnm_pc hhi27 i.districtPR if year==1927, cluster(districtPR)
quietly estimates store y27m
#delimit ;                                      
coefplot 
 (y21m,  msym(O) mcolor(black) mlabcolor(black) msize(large) ciopts(lcolor(black) lwidth(thick) recast(rcap)  )  ) 
 (y24m,  msym(O) mcolor(black) mlabcolor(black) msize(large) ciopts(lcolor(black) lwidth(thick) recast(rcap)  )  ) 
 (y27m,  msym(O) mcolor(black) mlabcolor(black) msize(large) ciopts(lcolor(black) lwidth(thick) recast(rcap)  )  ) 
 (y21,  msym(O) mcolor(gs7) mlabcolor(gs7) msize(large) ciopts(lcolor(gs7) lwidth(thick) recast(rcap)  )  ) 
 (y24,  msym(O) mcolor(gs7) mlabcolor(gs7) msize(large) ciopts(lcolor(gs7) lwidth(thick) recast(rcap)  )  ) 
 (y27,  msym(O) mcolor(gs7) mlabcolor(gs7) msize(large) ciopts(lcolor(gs7) lwidth(thick) recast(rcap)  )  ) 
 ,  yline(0, lcolor(black)) levels(95) scheme(s1mono) vertical legend(off) 
 ylabel(-0.2(0.2)0.8, labsize(vlarge)  ) 
 ytitle("The Effect of HHI", size(vlarge)  ) 
 keep(  hhi21 hhi24 hhi27 ) coeflabels( hhi21 = "1921"  hhi24 = "1924"  hhi27 = "1927"   , labsize(vlarge)   ) ysize(6)     ;
#delimit cr
*sub-figure b
reg  turng hhi21 i.districtPR if year==1921, cluster(districtPR)
quietly estimates store y21
reg  turng hhi24 i.districtPR if year==1924, cluster(districtPR)
quietly estimates store y24
reg  turng hhi27 i.districtPR if year==1927, cluster(districtPR)
quietly estimates store y27
#delimit ;                                      
coefplot 
 (y21,  msym(O) mcolor(gs10) mlabcolor(gs10) msize(large) ciopts(lcolor(gs10) lwidth(thick) recast(rcap)  )  ) 
 (y24,  msym(O) mcolor(gs10) mlabcolor(gs10) msize(large) ciopts(lcolor(gs10) lwidth(thick) recast(rcap)  )  ) 
 (y27,  msym(O) mcolor(gs10) mlabcolor(gs10) msize(large) ciopts(lcolor(gs10) lwidth(thick) recast(rcap)  )  ) 
 ,  yline(0, lcolor(black)) levels(95) scheme(s1mono) vertical legend(off) 
 ylabel(-0.2(0.2)0.8, labsize(vlarge)  ) 
 ytitle("The Effect of HHI", size(vlarge)  ) 
 keep(  hhi21 hhi24 hhi27 ) coeflabels( hhi21 = "1921"  hhi24 = "1924"  hhi27 = "1927"   , labsize(vlarge) ) ysize(6) ;
#delimit cr
*wild bootstrap-t, Rademacher weights, null imposed, 999 replications
use dta\nor2127, clear                 //using nor2127 data set                                                                   
reg  turng hhi i.districtPR if year==1921, cluster(districtPR)
boottest hhi 
reg  turng hhi i.districtPR if year==1924, cluster(districtPR)
boottest hhi 
reg  turng hhi i.districtPR if year==1927, cluster(districtPR)
boottest hhi                                                                    

*********************************
*Figure 5: Fixed Effect Models, Norway 1909-1927
*********************************
*Norway SMD: 1909-1918
use dta\nor0918_red, clear                        //using nor0918_red data set
gen margin_m = margin
gen margin_f = margin
gen margin_g = margin
xtreg  turnf_pc margin_f i.year, fe robust
quietly estimates store margin_f
xtreg  turnm_pc margin_m i.year, fe robust
quietly estimates store margin_m
xtreg  turng margin_g i.year, fe robust
quietly estimates store margin_g
#delimit ;                                      
 coefplot 
 (margin_m,   msym(o) mcolor(black) mlabcolor(black) msize(large) ciopts(lcolor(black) lwidth(thick) recast(rcap)  )  ) 
 (margin_f,   msym(o) mcolor(gs7)   mlabcolor(gs7)   msize(large) ciopts(lcolor(gs7)   lwidth(thick) recast(rcap)  )  ) 
 (margin_g,   msym(o) mcolor(gs10)   mlabcolor(gs10) msize(large) ciopts(lcolor(gs10)  lwidth(thick) recast(rcap)  )  )  
  ,  yline(0, lcolor(black)) levels(95) scheme(s1mono) title("", size(huge)) ysize(6)
  ylabel(-0.4(0.2)0.2, labsize(huge)) ytitle("Effect of Margin", size(huge))
  vertical legend(off) keep(margin_m margin_f margin_g) coeflabels(margin_m = "M"  margin_f = "W"  margin_g = "Gap"  , labsize(huge) )  ;
#delimit cr
*Norway PR: 1921-1927
use dta\nor2127_red, clear                        //using nor2127_red data set
gen hhi_m = hhi
gen hhi_f = hhi
gen hhi_g = hhi
xtreg  turng hhi_g  i.year, fe cluster(districtPR)  
quietly estimates store hhi_g
xtreg  turnf_pc hhi_f i.year , fe cluster(districtPR)  
quietly estimates store hhi_f
xtreg  turnm_pc hhi_m  i.year , fe cluster(districtPR)
quietly estimates store hhi_m
#delimit ;                                      
 coefplot 
 (hhi_m,   msym(o) mcolor(black) mlabcolor(black) msize(large) ciopts(lcolor(black) lwidth(thick) recast(rcap)  )  ) 
 (hhi_f,   msym(o) mcolor(gs7)   mlabcolor(gs7)   msize(large) ciopts(lcolor(gs7)   lwidth(thick) recast(rcap)  )  ) 
 (hhi_g,   msym(o) mcolor(gs10)   mlabcolor(gs10) msize(large) ciopts(lcolor(gs10)  lwidth(thick) recast(rcap)  )  )  
  ,  yline(0, lcolor(black)) levels(95) scheme(s1mono) title("", size(huge)) ysize(6)
  ylabel(-0.2(0.2)0.4, labsize(huge)) ytitle("Effect of HHI", size(huge))
  vertical legend(off) keep(hhi_m hhi_f  hhi_g) coeflabels(hhi_m = "M"  hhi_f = "W"  hhi_g= "Gap" , labsize(huge) )  ;
#delimit cr
*wild bootstrap-t, Rademacher weights, null imposed, 999 replications
xtreg  turng hhi  i.year, fe cluster(districtPR)
boottest hhi 

*********************************
*Figure 6: The Effect of Competition on Change in Turnout 1921-1918 by Sex in Norway
*********************************
use dta\nor_coxfivasmith, clear                       //using nor_coxfivasmith data set
*sub-figure a
#delimit ;
 twoway 
 (scatter ch_turnoutw margin18f if year==1921, mcolor(gs13) m(Oh))  (lfit ch_turnoutw margin18f if year==1921, lwidth(thick) lcolor(gray))
 (scatter ch_turnoutm margin18f if year==1921, mcolor(gs4) m(Oh))   (lfit ch_turnoutm margin18f if year==1921, lwidth(thick) lcolor(black))
 , ytitle(Change in (Final) Turnout 1921-1918, size(vlarge)) ylabel(-0.20(0.20)0.60, labsize(huge)) xtitle(Pre-Reform (Final) Margin 1918, size(vlarge)) xlabel(0(0.20)0.80, labsize(huge)) 
 title("", size(huge) nobox) note("", nobox) legend(off) scheme(s1mono) ysize(6) yline(0, lcolor (gray)) ;
#delimit cr
*sub-figure b
gen margin_m = margin18f
gen margin_f = margin18f
gen margin_g = margin18f
reg  ch_turnoutw margin_f if  year==1921, cluster(PR_district)
quietly estimates store margin_f
reg  ch_turnoutm margin_m if  year==1921, cluster(PR_district)
quietly estimates store margin_m
reg  ch_turnoutg margin_g if  year==1921, cluster(PR_district)
quietly estimates store margin_g
#delimit ;                                      
 coefplot 
 (margin_m,   msym(o) mcolor(black) mlabcolor(black) msize(large) ciopts(lcolor(black) lwidth(thick) recast(rcap)  )  ) 
 (margin_f,   msym(o) mcolor(gs7)   mlabcolor(gs7)   msize(large) ciopts(lcolor(gs7)   lwidth(thick) recast(rcap)  )  ) 
 (margin_g,   msym(o) mcolor(gs10)   mlabcolor(gs10) msize(large) ciopts(lcolor(gs10)  lwidth(thick) recast(rcap)  )  )  
 ,  yline(0, lcolor(black)) levels(95) scheme(s1mono) title("", size(huge)) ysize(6)
  ylabel(-0.25(0.25)0.75, labsize(huge)) ytitle("Effect of (Final) Margin 1918", size(vlarge))
  vertical legend(off) keep(margin_m margin_f  margin_g) coeflabels(margin_m = "M"  margin_f = "W"  margin_g = "Gap"  , labsize(huge) )  ;
#delimit cr
*wild bootstrap-t, Rademacher weights, null imposed, 999 replications
reg  ch_turnoutg margin18f if  year==1921, cluster(PR_district)
boottest margin18f

*********************************
*Figure 7: The Effect of Competition on Change in Turnout 1921-1918 by Sex in Norway; Marginal Effects
*********************************
use dta\nor_coxfivasmith, clear                       //using nor_coxfivasmith data set
sum ch_turnoutm, det, if year==1921 //identifying 5th, 95th and 75th percentiles
reg  ch_turnoutg c.margin18f##c.turnoutm18##c.ch_turnoutm if  year==1921, cluster(PR_district)
margins, dydx(margin18f) at(turnoutm18=(0.25(0.01)0.91) ch_turnoutm=(-0.08  0.1 0.25 ) ) vsquish noestimcheck //5th, 95th, 75th percentile
#delimit;
 marginsplot, addplot (hist turnoutm18,  color(none) lcolor(gray) lwidth(0.05) yaxis(2) yscale(alt) yscale(alt axis(2)) 
 ytitle("Marginal Effects of Pre-Reform Margin", size(vlarge) axis(1)) ytitle("Observations (%)", size(vlarge) axis(2))
 ylabel(0(2)8, labsize(vlarge) axis(2)) ylabel(-1(1)2, labsize(vlarge) axis(1)) xlabel(, labsize(vlarge)))
 title("", size(huge)) xtitle ("Men's Turnout in 1918", size(vlarge)) 
 plotopts(msymbol(o) msize(vlarge) lwidth(med) lpattern(solid) color()) ciopts(lpattern(dash) color() lwidth(medthick) msymbol (none)) recastci(rconnected)  
 yline(0, lcolor(black)) legend(off ) yscale(alt) scheme(s1mono) ysize(6) 
 note("Coeff. on triple product term 7.373 (p=0.015)", color(black) size(med))
 text(1.95 0.52 "Change in men's turnout at:", color(black) size(med))
 text(1.65 0.4 "0.1 (75th pctl)", color(gs10) size(med)) 
 text(1.8 0.41 "0.25 (95th pctl)", color(gs7) size(med)) 
 text(1.50 0.4 "-0.08 (5th pctl)", color(gs5) size(med)) ;
#delimit cr
*wild bootstrap-t, Rademacher weights, null imposed, 999 replications
gen mt = margin18f * turnoutm18
gen mc = margin18f * ch_turnoutm
gen tc = turnoutm18 * ch_turnoutm
gen mtc = margin18f * turnoutm18 * ch_turnoutm
reg  ch_turnoutg c.margin18f turnoutm18 ch_turnoutm mt mc tc mtc if  year==1921, cluster(PR_district)
boottest mtc 

*********************************
*Figure 8: Correlates of Women's and Men's Turnout in Additional Election Cases
*********************************
*New Zealand 1905
use dta\nz, clear                       //using nz data set
gen margin_m = margin
gen margin_f = margin
gen margin_g = margin
reg  turnf_pc margin_f , robust
quietly estimates store margin_f
reg  turnm_pc margin_m , robust
quietly estimates store margin_m
reg  turng margin_g , robust
quietly estimates store margin_g
#delimit ;                                      
 coefplot 
 (margin_m,   msym(o) mcolor(black) mlabcolor(black) msize(large) ciopts(lcolor(black) lwidth(thick) recast(rcap)  )  ) 
 (margin_f,   msym(o) mcolor(gs7)   mlabcolor(gs7)   msize(large) ciopts(lcolor(gs7)   lwidth(thick) recast(rcap)  )  ) 
  (margin_g,   msym(o) mcolor(gs10)   mlabcolor(gs10) msize(large) ciopts(lcolor(gs10)  lwidth(thick) recast(rcap)  )  )  
  ,  yline(0, lcolor(black)) levels(95) scheme(s1mono)  ysize(6)
  ylabel(-0.5(0.25)0.25, labsize(vlarge)) ytitle("Effect of Margin", size(vlarge))
  vertical legend(off) keep(margin_m margin_f  margin_g) coeflabels(margin_m = "M"  margin_f = "W"  margin_g = "Gap" , labsize(vlarge) )  ;
#delimit cr
*Sweden 1921
use dta\swe, clear                       //using swe data set
gen hhi_m = hhi
gen hhi_f = hhi
gen hhi_g = hhi
reg  turng hhi_g i.county_enc, cluster(county_enc)
quietly estimates store hhi_g
reg  turnf_pc hhi_f i.county_enc, cluster(county_enc)
quietly estimates store hhi_f
reg  turnm_pc hhi_m i.county_enc, cluster(county_enc)
quietly estimates store hhi_m
#delimit ;                                      
 coefplot 
 (hhi_m,   msym(o) mcolor(black) mlabcolor(black) msize(large) ciopts(lcolor(black) lwidth(thick) recast(rcap)  )  ) 
 (hhi_f,   msym(o) mcolor(gs7)   mlabcolor(gs7)   msize(large) ciopts(lcolor(gs7)   lwidth(thick) recast(rcap)  )  ) 
  (hhi_g,   msym(o) mcolor(gs10)   mlabcolor(gs10) msize(large) ciopts(lcolor(gs10)  lwidth(thick) recast(rcap)  )  )  
  ,  yline(0, lcolor(black)) levels(95) scheme(s1mono)  ysize(6)
  ylabel(-0.25(0.25)0.5, labsize(vlarge)) ytitle("Effect of HHI", size(vlarge))
  vertical legend(off) keep(hhi_m hhi_f  hhi_g) coeflabels(hhi_m = "M"  hhi_f = "W"   hhi_g = "Gap" , labsize(vlarge) )  ;
#delimit cr
*wild bootstrap-t, Rademacher weights, null imposed, 999 replications
reg turng hhi i.county_enc, cluster(county_enc)
boottest hhi  
*Austria 1927
use dta\aus, clear                       //using aus data set
gen hhi_m = hhi
gen hhi_f = hhi
gen hhi_g = hhi
reg  turng hhi_g i.const_enc, cluster(const_enc)
quietly estimates store hhi_g
reg  turnf_pc hhi_f i.const_enc, cluster(const_enc)
quietly estimates store hhi_f
reg  turnm_pc hhi_m i.const_enc, cluster(const_enc)
quietly estimates store hhi_m
#delimit ;                                      
 coefplot 
 (hhi_m,   msym(o) mcolor(black) mlabcolor(black) msize(large) ciopts(lcolor(black) lwidth(thick) recast(rcap)  )  ) 
 (hhi_f,   msym(o) mcolor(gs7)   mlabcolor(gs7)   msize(large) ciopts(lcolor(gs7)   lwidth(thick) recast(rcap)  )  ) 
  (hhi_g,   msym(o) mcolor(gs10)   mlabcolor(gs10) msize(large) ciopts(lcolor(gs10)  lwidth(thick) recast(rcap)  )  )  
  ,  yline(0, lcolor(black)) levels(95) scheme(s1mono) ysize(6)
  ylabel(-0.25(0.25)0.5, labsize(vlarge)) ytitle("Effect of HHI", size(vlarge))
  vertical legend(off) keep(hhi_m hhi_f hhi_g) coeflabels(hhi_m = "M"  hhi_f = "W"  hhi_g = "Gap" , labsize(vlarge) )  ;
#delimit cr
*wild bootstrap-t, Rademacher weights, null imposed, 999 replications
reg  turng hhi i.const_enc, cluster(const_enc)
boottest hhi 


*********************************
*predicted values to calculate by how much predicted gender gap shrinks with competition; section around Figure 5
*********************************
*Norway SMD: 1909-1918
use dta\nor0918_red, clear                        //using nor0918_red data set
xtreg  turng margin i.year, fe robust
sum margin    //identifies min and max values
margins, at( margin=(0.013 96.43)) atmeans noatlegend //23.39673-15.60797 = 7.78876 (gap shrinks by 7.8pp)
marginsplot, noci
*Norway PR: 1921-1927
use dta\nor2127_red, clear                        //using nor2127_red data set
xtreg  turng hhi  i.year, fe cluster(districtPR)  
sum hhi      //identifies min and max values
margins, at( hhi=(7.73 93.92)) atmeans noatlegend //21.18252-15.80626 = 5.37626 (gap shrinks by 5.4pp)
marginsplot, noci

***********************************
*average turnout by competition; footnote 16
***********************************
*Norway 1909-1918
use dta\nor0918, clear                        //using nor0918 data set
bys margin_10: sum turn_pc //majority votes in nice deciles of margin
*Norway 1921-1927
use dta\nor2127, clear                        //using nor2127 data set          
bys hhi_10: sum turn_pc.   //majority votes in all deciles of HHI



